//
//  ViewController.m
//  NewDaliy
//
//  Created by xuPeng on 2017/8/25.
//  Copyright © 2017年 陈旭鹏. All rights reserved.
//

#import "HomeViewController.h"
#import <AFNetworking.h>
#import "SuspensionView.h"
#import "MenuView.h"

@interface HomeViewController ()<UITableViewDelegate,SuspensionViewDelegate,MenuViewDelegate,SuspensionViewDelegate>
@property (nonatomic, strong) UITableView *homeTableView;

// 悬浮Button
@property (nonatomic, strong) SuspensionView *btnView;

@property (nonatomic, strong) MenuView *menuView;
@end

@implementation HomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
    [self.view addSubview:self.homeTableView];
    [self.view addSubview:self.btnView];
    
}
- (UITableView *)homeTableView{
    if (!_homeTableView) {
        _homeTableView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStylePlain];
        _homeTableView.delegate = self;
    }

    return _homeTableView;
}

//  菜单View
- (MenuView *)menuView{
    if (!_menuView) {
        _menuView = [[MenuView alloc] initWithFrame:self.view.bounds];
        _menuView.backgroundColor = [UIColor clearColor];
        _menuView.delegate = self;
    }
    return _menuView;
}
- (SuspensionView *)btnView{
    
    if (!_btnView) {
        _btnView = [[SuspensionView alloc] initWithFrame:CGRectMake(10, [UIScreen mainScreen].bounds.size.height - 70, 54, 54)];
        _btnView.delegate = self;
        //设置按钮样式（tag）
        _btnView.SuspensionButtonStyle = SuspensionButtonStyleQType;
    }
    return _btnView;
}
- (void)viewWillAppear:(BOOL)animated{
    self.navigationController.navigationBarHidden = YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - JFSuspensionViewDelegate

- (void)popUpMenuView {
    [self.view insertSubview:self.menuView
                belowSubview:self.btnView];
    [self.menuView popupMenuViewAnimation];
}

- (void)closeMenuView {
    [_menuView hideMenuViewAnimation];
}

@end
